		<table border="0" cellspacing="5" cellpadding="5" align="center" style="width:45em;max-width:45em;">
		  <tr><td colspan="2" class="title">学校基本信息</td></tr>
		  <tr>
		    <td class="right">学校所在地区</td>
		    <td><span id="area-title"><%= @school.area.blank? ? "未选择地区" : @school.area.title %></span> <%= link_to_remote "选择", :url => {:controller => 'geo', :action => 'list', :id => @school.area}, :before => "Element.hide('areas-list');Element.hide('areas-list-notice');Element.show('areas-list-spinner')" %></td>
		  </tr>
		  <tr>
		    <td colspan="2">
		      <div id="areas-list-spinner" style="display:none;color:gray;">正在获得地区列表 ...</div>
          <div id="areas-list-notice" style ="display:none;color:gray;"></div>
          <div id="areas-list" style="display:none;"></div>
          <%= form.hidden_field :area_id %>
		    </td>
		  </tr>
		  <tr>
		    <td class="right">学校名称</td>
		    <td><%= form.text_field :title, :size => 15 %></td>
		  </tr>
		  <tr>
		    <td class="right">学校地址</td>
		    <td><%= form.text_field :address %></td>
		  </tr>
		  <tr>
		    <td class="right">邮政编码</td>
		    <td><%= form.text_field :zipcode, :size => 8 %></td>
		  </tr>
		  <tr>
		    <td class="right">校长姓名</td>
		    <td><%= form.text_field :schoolmaster, :size => 8 %></td>
		  </tr>
		  <tr>
		    <td class="right">学校电话</td>
		    <td><%= form.text_field :school_telephone %></td>
		  </tr>
		  <tr>
		    <td class="right">学校联系人</td>
		    <td><%= form.text_field :contact, :size => 8 %></td>
		  </tr>
		  <tr>
		    <td class="right">联系人电话</td>
		    <td><%= form.text_field :contact_telephone %></td>
		  </tr>
		  <tr>
		    <td class="right">联系人邮件</td>
		    <td><%= form.text_field :contact_email %></td>
		  </tr>
		  <tr>
		    <td class="right">行政教师</td>
		    <td><%= form.text_field :admin_amount, :size => 3 %>人</td>
		  </tr>
		  <tr>
		    <td class="right">授课教师</td>
		    <td><%= form.text_field :teacher_amount, :size => 3%>人</td>
		  </tr>
		  <tr>
		    <td class="right">学制</td>
		    <td><%= form.text_field :level_amount, :size => 3 %>年</td>
		  </tr>
		  <tr>
		    <td class="right">班级数量</td>
		    <td><%= form.text_field :class_amount, :size => 3 %></td>
		  </tr>
		  <tr>
		    <td class="right">在校学生数</td>
		    <td><%= form.text_field :student_amount, :size => 4 %></td>
		  </tr>
		  <tr>
		    <td class="right">是否有图书室</td>
		    <td><%= form.radio_button :has_library, 'true' %>是 <%= form.radio_button :has_library, 'false', :checked => 'checked' %>否</td>
		  </tr>
		  <tr>
		    <td class="right">现有图书</td>
		    <td><%= form.text_field :book_amount, :size => 4 %>册</td>
		  </tr>
		  <tr>
		    <td class="right">是否有电脑</td>
		    <td><%= form.radio_button :has_pc, 'true' %>是 <%= form.radio_button :has_pc, 'false', :checked => 'checked' %>否, 现有电脑 <%= form.text_field :pc_amount, :size => 4 %>台</td>
		  </tr>
		  <tr>
		    <td class="right">是否能上网</td>
		    <td><%= form.radio_button :has_internet, 'true' %>是, <%= form.radio_button :has_internet, 'false', :checked => 'checked' %>否</td>
		  </tr>
		  <tr>
		    <td class="right">乡村主要收入来源</td>
		    <td><%= form.text_field :income_from, :size => 25 %><br />
		      <span style="color:gray">点击链接可以直接添加到输入框中，其他需求请自己输入并以空格隔开</span><br />
    		  <span id="income_from_tags">
    		    <%= tags_selector_for "income_from", %w(农业 手工业 畜牧业 旅游业) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">当地年人均收入</td>
		    <td><%= form.text_field :average_income, :size => 8 %>元</td>
		  </tr>
		  <tr>
		    <td class="right">是否有公益组织或民间人士跟进</td>
		    <td><%= form.radio_button :has_ngo, 'true', :onclick => "Element.show('ngo-1')" %>是, <%= form.radio_button :has_ngo, 'false', :checked => 'checked', :onclick => "Element.hide('ngo-1')" %>否</td>
		  </tr>
		  <tr id="ngo-1" style="display:none;">
		    <td></td>
		    <td>
		      <table border="0" cellspacing="5" cellpadding="5" class="inner">
		        <tr>
		          <td class="right">项目名称</td>
		          <td><%= form.text_field :prj_title, :size => 15 %></td>
		        </tr>
		        <tr>
		          <td class="right">开始时间</td>
		          <td><select id="school_start_at_1i" name="school[start_at(1i)]">
    		    <option value="1990">1990</option>  
    		    <option value="1991">1991</option>  
    		    <option value="1992">1992</option>  
    		    <option value="1993">1993</option>  
    		    <option value="1994">1994</option>
    		    <option value="1995">1995</option>
    		    <option value="1996">1996</option>
    		    <option value="1997">1997</option>  
    		    <option value="1998">1998</option>
    		    <option value="1999">1999</option>
    		    <option value="2000">2000</option>
            <option value="2001">2001</option>
            <option value="2002">2002</option>
            <option value="2003">2003</option>
            <option value="2004">2004</option>
            <option value="2005">2005</option>
            <option value="2006">2006</option>
            <option value="2007">2007</option>
            <option value="2008" selected="selected">2008</option>
            <option value="2009">2009</option>
            <option value="2010">2010</option>
            </select><select id="school_start_at_2i" name="school[start_at(2i)]">
            <option value="1" selected="selected">一月</option>
            <option value="2">二月</option>
            <option value="3">三月</option>
            <option value="4">四月</option>
            <option value="5">五月</option>
            <option value="6">六月</option>
            <option value="7">七月</option>
            <option value="8">八月</option>
            <option value="9">九月</option>
            <option value="10">十月</option>
            <option value="11">十一月</option>
            <option value="12">十二月</option>
            </select><select id="school_start_at_3i" name="school[start_at(3i)]">
            <option value="1" selected="selected">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="9">9</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
            <option value="13">13</option>
            <option value="14">14</option>
            <option value="15">15</option>
            <option value="16">16</option>
            <option value="17">17</option>
            <option value="18">18</option>
            <option value="19">19</option>
            <option value="20">20</option>
            <option value="21">21</option>
            <option value="22">22</option>
            <option value="23">23</option>
            <option value="24">24</option>
            <option value="25">25</option>
            <option value="26">26</option>
            <option value="27">27</option>
            <option value="28">28</option>
            <option value="29">29</option>
            <option value="30">30</option>
            <option value="31">31</option>
            </select></td>
		        </tr>
		        <tr>
		          <td class="right">联系人</td>
		          <td><%= form.text_field :prj_contact, :size => 8 %></td>
		        </tr>
		        <tr>
		          <td class="right">联系方式</td>
		          <td><%= form.text_field :prj_contact_method, :size => 18 %></td>
		        </tr>
		      </table>
		    </td>
		  </tr>
		  
		  <tr><td colspan="2"><hr /></td></tr>
		  
		  <tr>
		    <td colspan="2" class="title">交通指南<span style="font-size:0.8em;color:gray;">(从临近城市或景点到该学校的交通)</span></td>
		  </tr>
		  <tr>
		    <td class="right">附近景点</td>
		    <td><%= form.text_field :near_place, :size => 15 %></td>
		  </tr>
		  <tr>
		    <td class="right">交通方式</td>
		    <td><%= form.text_field :traffic_type, :size => 35 %><br /><span style="color:gray">点击链接可以直接添加到输入框中，其他需求请自己输入并以空格隔开</span><br />
    		  <span id="traffic_type_tags">
    		    <%= tags_selector_for "traffic_type", %w(火车 汽车 骑车 步行) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">路程时间</td>
		    <td><%= form.text_field :traffic_duration, :size => 6 %> 小时</td>
		  </tr>
		  <tr>
		    <td class="right" style="vertical-align:top">路线攻略</td>
		    <td><%= form.text_area :traffic_description, :rows => 5, :column => 15 %></td>
		  </tr>
		  <tr>
		    <td class="right">交通费用</td>
		    <td><%= form.text_field :traffic_charge, :size => 6 %> 元</td>
		  </tr>
		  
		  <tr><td colspan="2"><hr /></td></tr>
		  
		  <tr>
		    <td colspan="2" class="title">学校需求调查<span style="font-size:0.8em;color:gray">(点击链接可以直接添加到输入框中，其他需求请自己输入并以空格隔开)</span></td>
		  </tr>
		  <tr>
		    <td class="right">书籍类</td>
		    <td><%= form.text_field :books_need, :size => 35%><br />
    		  <span id="books_need_tags">
    		    <%= tags_selector_for "books_need", %w(教辅 字典 课外书) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">文具类</td>
		    <td><%= form.text_field :stationaries_need, :size => 35%><br />
    		  <span id="stationaries_need_tags">
    		    <%= tags_selector_for "stationaries_need", %w(笔 橡皮 文具盒 书包 本子) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">文体类</td>
		    <td><%= form.text_field :sports_need, :size => 35%><br />
    		  <span id="sports_need_tags">
    		    <%= tags_selector_for "sports_need", %w(球类 跳绳 棋类 益智类) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">衣服类</td>
		    <td><%= form.text_field :clothes_need, :size => 35%><br />
    		  <span id="clothes_need_tags">
    		    <%= tags_selector_for "clothes_need", %w(棉衣 运动服 鞋子) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">教具类</td>
		    <td><%= form.text_field :accessories_need, :size => 35%><br />
    		  <span id="accessories_need_tags">
    		    <%= tags_selector_for "accessories_need", %w(尺子 圆规 三角板 粉笔) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">其它</td>
		    <td><%= form.text_field :others_need, :size => 35%><br />
    		  <span id="others_need_tags">
    		    <%= tags_selector_for "others_need", %w(实验用具 课桌椅 玩具) %>
    		  </span></td>
		  </tr>
		  <tr>
		    <td class="right">学校活动需求</td>
		    <td><%= form.text_field :classes_need, :size => 35%><br />
    		  <span id="classes_need_tags">
    		    <%= tags_selector_for "classes_need", %w(电脑课 音乐课 环保课 安全自救培训 英语课) %>
    		  </span></td>
		  </tr>
		  
		  <tr><td colspan="2"><hr /></td></tr>
		  
		  <tr>
		    <td colspan="2" class="title">信息收集人</td>
		  </tr>
		  <tr>
		    <td class="right">志愿者姓名</td>
		    <td><%= form.text_field :finder, :size => 8 %></td>
		  </tr>
		  <tr>
		    <td class="right">Email</td>
		    <td><%= form.text_field :finder_email, :size => 18 %></td>
		  </tr>
		  <tr>
		    <td class="right">QQ</td>
		    <td><%= form.text_field :finder_qq, :size => 18 %></td>
		  </tr>
		  <tr>
		    <td class="right">MSN</td>
		    <td><%= form.text_field :finder_msn, :size => 18 %></td>
		  </tr>
		  <tr>
		    <td class="right">调查时间</td>
		    <td><select id="school_find_at_1i" name="school[find_at(1i)]">
          <option value="1990">1990</option>  
  		    <option value="1991">1991</option>  
  		    <option value="1992">1992</option>  
  		    <option value="1993">1993</option>  
  		    <option value="1994">1994</option>
  		    <option value="1995">1995</option>
  		    <option value="1996">1996</option>
  		    <option value="1997">1997</option>  
  		    <option value="1998">1998</option>
  		    <option value="1999">1999</option>
  		    <option value="2000">2000</option>
          <option value="2001">2001</option>
          <option value="2002">2002</option>
          <option value="2003">2003</option>
          <option value="2004">2004</option>
          <option value="2005">2005</option>
          <option value="2006">2006</option>
          <option value="2007">2007</option>
          <option value="2008" selected="selected">2008</option>
          <option value="2009">2009</option>
          <option value="2010">2010</option>
        </select>
        <select id="school_find_at_2i" name="school[find_at(2i)]">
          <option value="1" selected="selected">一月</option>
          <option value="2">二月</option>
          <option value="3">三月</option>
          <option value="4">四月</option>
          <option value="5">五月</option>
          <option value="6">六月</option>
          <option value="7">七月</option>
          <option value="8">八月</option>
          <option value="9">九月</option>
          <option value="10">十月</option>
          <option value="11">十一月</option>
          <option value="12">十二月</option>
        </select>
        <select id="school_find_at_3i" name="school[find_at(3i)]">
        <option value="1" selected="selected">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14">14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>
        <option value="30">30</option>
        <option value="31">31</option>
        </select></td>
		  </tr>
		  <tr>
		    <td class="right" style="vertical-align:top">活动建议</td>
		    <td><%= form.text_area :finder_advise, :rows => 5, :column => 18 %></td>
		  </tr>
		</table>

<script type="text/javascript">
String.prototype.trim = function() { a = this.replace(/^\s+/, ''); return a.replace(/\s+$/, ''); };
var lastEdit = "";

function swap(inputedTags, tag) {
  inputedTags = $("school_" + inputedTags)
	var tagArray = inputedTags.value.trim().split(' ');
	var present = false;
	var t, tl = tag.toLowerCase();
	
	if (tagArray[0].trim() == '') tagArray.splice(0,1);
	for (t=0; t<tagArray.length; t++) {
		if (tagArray[t].toLowerCase() == tl) { tagArray.splice(t,1); present = true; t-=1; }
	}
	if (!present) {tagArray.push(tag); }
	var content = tagArray.join(' ');
	lastEdit = inputedTags.value = (content.length > 1) ? content + ' ' : content;
	focusTo(inputedTags);
}
// focus the caret to end of a form input (+ optionally select some text)
var range=0 //ie
function focusTo(obj, selectFrom) {
	if (typeof selectFrom == 'undefined') selectFrom = obj.value.length
	if(obj.createTextRange){ //ie + opera
		if (range == 0) range = obj.createTextRange()
		range.moveEnd("character",obj.value.length)
		range.moveStart("character",selectFrom)
		obj.select()
		range.select()
		setTimeout('range.select()', 10)
	} else if (obj.setSelectionRange){ //ff
		obj.select()
		obj.setSelectionRange(selectFrom,obj.value.length)
	} else { //safari :(
	 obj.blur()
}}

// set area's id to hidden field(id:school_area_id)
function select_area(id, title) {
  $('school_area_id').value = id;
  $('areas-list-notice').innerHTML = "您已将学校所在地选定为 " + title;
  $('area-title').innerHTML = title;
  Element.show('areas-list-notice');
  Element.hide('areas-list-spinner');
  Element.hide('areas-list');
}
</script>